package it.gius.pe.aabb;

import org.jbox2d.common.Vec2;

public class AABoundaryBox {
	
	public static final int X_AXIS = 0;
	public static final int Y_AXIS = 1;

	public int epMMins[];
	public int epMMaxs[];	                     

	public Vec2 lowerBound;
	public Vec2 upperBound;


	public AABoundaryBox() {
		this(new Vec2(),new Vec2());
	}

	public AABoundaryBox(Vec2 lowerBound, Vec2 upperBound) {
		this.lowerBound = lowerBound;
		this.upperBound = upperBound;

		epMMins = new int[2]; //0 -> x axis ; 1 -> y axis
		epMMaxs = new int[2]; //0 -> x axis ; 1 -> y axis
		
		
	}
	
	
	public boolean contains(AABoundaryBox other)
	{
		return (this.lowerBound.x < other.lowerBound.x && this.lowerBound.y < other.lowerBound.y &&
				this.upperBound.x > other.upperBound.x && this.upperBound.y > other.upperBound.y);
	}

	public static boolean overlap(AABoundaryBox a, AABoundaryBox b)
	{
		if(a.lowerBound.x > b.upperBound.x || b.lowerBound.x > a.upperBound.x)
			return false;

		if(a.lowerBound.y > b.upperBound.y || b.lowerBound.y > a.upperBound.y)
			return false;



		return true;
	}


}
